/**
 * Created by eva on 2019/12/29.
 */
function Ane() {
    this.x = [];
    this.len = [];
    this.num = 50;
    //start point , control point, end point(sin)
    this.headx = [];
    this.heady = [];
    this.amp = [];
    this.alpha = 0;
}
Ane.prototype = {
    init : function () {
        var h = can1.height;
        for(var i = 0; i < this.num; i++){
            this.x[i] = i*17 + Math.random()*20;
            //this.len[i] = 200 + Math.random()*50;
            this.headx[i] = this.x[i];
            this.heady[i] = h - 250+Math.random()*50;
            this.amp[i] = Math.random()*50+50;
        }
    },
    draw : function () {
        this.alpha += deltaTime*0.002;
        var l = Math.sin(this.alpha);
        ctx2.save();
        ctx2.globalAlpha = 0.6;
        ctx2.lineWidth = 20;
        ctx2.lineCap = "round";
        ctx2.strokeStyle = "#3b154e";
        for(var i = 0; i < this.num; i++){
            ctx2.beginPath();
            ctx2.moveTo(this.x[i],canHeight);
            this.headx[i] = this.x[i] + this.amp[i]*l;
            ctx2.quadraticCurveTo(this.x[i],canHeight - 100,this.headx[i],this.heady[i]);

            ctx2.stroke();
        }
        ctx2.restore();
    }
}